% initial data
x = [-0.25;1.75];  % current iterate
[fx,gx] = rosenbrock(x);  % evaluate current iterate
f_initial = fx            % initial function value


% 1. Bisection on rosenbrock
% use negative gradient direction for bisection
disp('')
disp('BS: Use of gradient direction ...')
s = -gx/norm(gx);  % normalized direction
check_descent = gx'*s

% determine alpha_opt with bisektion
% lbound is 0 (since s is descent direction)
% rbound is 1 (just a guess, bisection checks whether this is
% a valid point, if not determines valid point)
% instead of 'rosenbrock' the argument could also be @rosenbrock
[alpha_grad_BS, stats_grad_BS] = PolynomInterpolation(0, 1, 'rosenbrock', x, s, 500);

plot(stats_grad_BS, alpha_grad_BS);
ylabel("alpha");
xlabel("iterations");